package http

const (
	GetNVRList_URL    = `/api/getNVRList`
	GetStreamList_URL = `/api/getStreamList`

	DeviceLogin_URL      = `/api/deviceLogin`
	DeviceLoginMulti_URL = `/api/deviceLoginMulti`

	DeviceLogout_URL = `/api/deviceLogout`

	GuardControl_URL = `/api/GuardControl`
	//设备云台巡航【非国标】
	CruiseControl_URL = `/api/CruiseControl`
	//设备事件订阅更新
	UpdateSubscription_URL = `/api/UpdateSubscription`

	StartRealPlay_URL = `/api/startRealPlay`

	//历史文件下载
	DownloadHistoryFile_URL = `/api/downloadHistoryFile`
	//历史文件下载通过文件名
	DownloadHistoryFileByName_URL = `/api/downloadHistoryFileByName`
	//获取历史文件下载进度条
	GetHistoryFileDownloadSchedule_URL = `/api/getHistoryFileDownloadSchedule`
	//搜索历史文件
	SearchHistoryFile_URL = `/api/searchHistoryFile`

	//历史视频调阅
	PlayHistoryFileByTime_URL = `/api/playHistoryFileByTime`
	//播放历史文件
	PlayHistoryFileByName_URL = `/api/playHistoryFileByName`
	//历史视频调阅拖动
	SipStreamOffset_URL = `/api/SipStreamOffset`
	SipStreamScale_URL  = `/api/SipStreamScale`

	StopPlayByDeviceID_URL          = `/api/stopPlayByDeviceID`
	StopPlayHistoryFileByTime_URL   = `/api/stopPlayHistoryFileByTime`
	StopPlayHistoryFileByName_URL   = `/api/stopPlayHistoryFileByName`
	QB_GetDeviceConnectInfoList_URL = `/api/QB_GetDeviceConnectInfoList`
	QB_ModifyDeviceInfo_URL         = `/api/QB_ModifyDeviceInfo`

	PublishNotice_URL         = `/api/PublishNotice`
	SendConnectCenterData_URL = `/api/SendConnectCenterData`
	AlarmReport_URL           = `/v1/rec_device_tag/nvr/alarm/create`
	GetCameraGuardInfo_URL    = `/api/getDeviceGuardInfo`
	RebootNotify_URL          = `/api/rebootNotify`

	//預置點列表
	PtzControl_URL    = `/api/PTZControl`    //預置點 執行接口
	PresetList_URL    = `/api/presetList`    //預置點 列表
	PresetControl_URL = `/api/PresetControl` //預置點 編輯(1=设置，2=删除，3=转到预置点)

	//音频控制接口
	OpenVoiceServer_URL  = `/api/openVoiceServer`
	CloseVoiceServer_URL = `/api/closeVoiceServer`
)

// NvrDevice 设备基本信息
type NvrDevice struct {
	Tid          string `json:"tid"`
	NvrDeviceID  string `json:"nvrDeviceID"`  // NVR 设备ID
	NvrChannelID int64  `json:"nvrChannelID"` // NVR 设备通道
	DeviceSipID  string `json:"deviceSipID"`  // 设备ID
	LinkMode     int64  `json:"linkMode"`     // 连接模式
}

// DeviceLogin 设备登录
type DeviceLogin struct {
	NvrDevice
	IndexNum   uint32 `json:"Index_"`
	LoginType  int64  `json:"loginType"`
	DeviceIP   string `json:"deviceIP"`
	DevicePort int64  `json:"devicePort"`
	DevToken   string `json:"devToken"` //userName + userPassword + =@=哈希
	SeaVi      string `json:"sea_vi"`
	//UserName     string `json:"userName"`
	//UserPassword string `json:"userPassword"`
	DccID       string
	ProgressBar string
}

type SendDeviceLogin struct {
	Tid         string
	Data        []DeviceLogin
	ProgressBar string //进度条
	Response
}

// GetNVRList 获取
type GetNVRList struct {
}

// DeviceLogout 设备注销
type DeviceLogout struct {
	NvrDevice
	Disabled bool
}

// StartRealPlay 实时调阅
type StartRealPlay struct {
	NvrDevice
	AddID           string `json:"addID"`
	StreamID        string `json:"streamID"`
	MediaServerIP   string `json:"mediaServerIP"`
	MediaServerPort int64  `json:"mediaServerPort"`
}

// StopPlayByDeviceID 停止调阅
type StopPlayByDeviceID struct {
	NvrDevice
}

// PlayHistoryFileByName 播放历史视频
type PlayHistoryFileByName struct {
	NvrDevice
	AddID           string `json:"addID"`
	StreamID        string `json:"streamID"`
	FileName        string `json:"fileName"`
	MediaServerIP   string `json:"mediaServerIP"`
	MediaServerPort int64  `json:"mediaServerPort"`
}

type History struct {
	StartYear   int64 `json:"startYear"`
	StartMonth  int64 `json:"startMonth"`
	StartDay    int64 `json:"startDay"`
	StartHour   int64 `json:"startHour"`
	StartMinute int64 `json:"startMinute"`
	StartSecond int64 `json:"startSecond"`
	EndYear     int64 `json:"endYear"`
	EndMonth    int64 `json:"endMonth"`
	EndDay      int64 `json:"endDay"`
	EndHour     int64 `json:"endHour"`
	EndMinute   int64 `json:"endMinute"`
	EndSecond   int64 `json:"endSecond"`

	StartTimeStamp int64 `json:"startTimeStamp"`
	EndTimeStamp   int64 `json:"endTimeStamp"`
}

type SearchHistoryFile struct {
	NvrDevice
	History
}

type SearchPreset struct { // 預置點查詢
	NvrDevice
}

// PresetControlParam 设备预置点操作参数
type PresetControlParam struct {
	NvrDevice
	PresetName string //预置点名称
	PresetCmd  uint8  //预置点命令 1=设置预置点, 2=清除预置点, 3=转到预置点
	PresetNum  int64  //预置点序号
	IsReboot   bool   //是否是重启预置点
}

type GetStreamList struct {
}

type PtzControl struct {
	/* PtzCommand
	//Ptz_UP\
	//nPtz_DOWN\
	//nPtz_LEFT\
	//nPtz_RIGHT\
	//nPtz_UPLEFT\
	//nPtz_DOWNLEFT\
	//nPtz_UPRIGHT\
	//nPtz_DOWNRIGHT\
	//nPtz_ZOOMOUT\
	//nPtz_ZOOMIN
	*/
	NvrDevice
	PtzCommand   string `json:"ptzCommand"`
	PtzSpeed     int64  `json:"ptzSpeed"`     // "0默认，1-7速度值"
	StartControl int    `json:"startControl"` //"1开始，-1停止"
	IsPriority   bool   `json:"isPriority"`   //是否是高优先级
}

type PublishNotice struct {
}

type GuardControl struct {
}

type StopPlayHistoryFileByName struct {
	NvrDevice
	FileName string `json:"fileName"`
}

type PlayHistoryFileByTime struct {
	NvrDevice
	History
	AddID           string `json:"addID"`
	StreamID        string `json:"streamID"`
	MediaServerIP   string `json:"mediaServerIP"`
	MediaServerPort int64  `json:"MediaServerPort"`
	DownloadSpeed   int64  `json:"downloadSpeed"`
}

type StopPlayHistoryFileByTime struct {
	NvrDevice
	PlayID string `json:"playID"` //咧: "myDeviceID-33-2023-08-15 09:09:00-2023-08-15 09:30:00"
}

// ReqHistoryFile 请求历史文件
type ReqHistoryFile struct {
	NvrDevice
	StartTime int64
	EndTime   int64
	FileName  string `json:"fileName"`
}

// 历史文件相应
type RespHistoryFile struct {
	Code     int    `json:"code"`
	Msg      string `json:"msg"`
	FileName string `json:"fileName"`
}

type Schedule struct {
	Response
	FileName string `json:"fileName"`
	Schedule int    `json:"schedule"`
	Url      string `json:"url"`
}

type RespDeviceLogin struct {
	Code           int    `json:"code"`
	DeviceIP       string `json:"deviceIP"`
	DeviceSipID    string `json:"deviceSipID"`
	LoginType      int    `json:"loginType"`
	Msg            string `json:"msg"`
	VideoEncType   string `json:"videoEncType"`
	StartDCChannel int    `json:"startDCChannel"`
	TotalDCChannel int    `json:"totalDCChannel"`
}

type Response struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

type OnlineNVR struct {
	DeviceIP       string `json:"deviceIP"`
	DeviceSipID    string `json:"deviceSipID"`
	LoginType      int    `json:"loginType"`
	StartDCChannel int    `json:"startDCChannel"`
	TotalDCChannel int    `json:"totalDCChannel"`
}

type RespNvrList struct {
	AllOnlineNVR      []OnlineNVR `json:"allOnlineNVR"`
	AllOnlineNVRCount int         `json:"allOnlineNVRCount"`
	Code              int         `json:"code"`
	Msg               string      `json:"msg"`
}

type FileTime struct {
	Day         int `json:"day"`
	Hour        int `json:"hour"`
	MilliSecond int `json:"milliSecond"`
	Minute      int `json:"minute"`
	Month       int `json:"month"`
	Second      int `json:"second"`
	Year        int `json:"year"`
}
type HistoryFile struct {
	StartTime      FileTime `json:"startTime"`
	EndTime        FileTime `json:"endTime"`
	FileName       string   `json:"fileName"`
	FileSize       int      `json:"fileSize"`
	StartTimeStamp string   `json:"startTimeStamp"`
	EndTimeStamp   string   `json:"endTimeStamp"`
}

// 視頻歷史文獻
type RespSearchHistoryFile struct {
	AllHistoryFile      []HistoryFile `json:"allHistoryFile"`
	AllHistoryFileCount int           `json:"allHistoryFileCount"`
	Code                int           `json:"code"`
	Msg                 string        `json:"msg"`
	NvrDevice
	SearchStartTime FileTime `json:"searchStartTime"`
	SearchEndTime   FileTime `json:"searchEndTime"`
}

// 預置點
type Preset struct {
	PresetName string `json:"presetName"`
	PresetID   int    `json:"presetID"`
	IsSetPos   bool   `json:"isSetPos"`
}

// 預置點列表
type RespSearchPresetList struct {
	AllPresetList      []Preset `json:"allPresetList"`
	AllPresetListCount int      `json:"allPresetListCount"`
	NvrDevice
	Response `gorm:"-"`
}

// 历史视频调阅 返回值
type RespPlayHistoryFileByTime struct {
	Code   int    `json:"code"`
	Msg    string `json:"msg"`
	PlayID string `json:"playID"`
}

type StreamInfo struct {
	HistoryFileName  string `json:"historyFileName"`
	MediaServerIP    string `json:"mediaServerIP"`
	MediaServerPort  int    `json:"mediaServerPort"`
	NvrChannelID     int    `json:"nvrChannelID"`
	NvrDeviceID      string `json:"nvrDeviceID"`
	DeviceSipID      string `json:"deviceSipID"`
	Ssrc             string `json:"ssrc"`
	AddID            string `json:"addID"`
	StreamID         string `json:"streamID"`
	StreamType       int    `json:"streamType"`
	StreamTypeRemark string `json:"streamTypeRemark"`
}

type RespStreamList struct {
	AllStreamInfo      []StreamInfo `json:"allStreamInfo"`
	AllStreamInfoCount int          `json:"allStreamInfoCount"`
	Code               int          `json:"code"`
	Msg                string       `json:"msg"`
}
